﻿using AutoMapper;
using SIG.Model.Case;
using SIG.Service.Case;
using SIG.ViewModel.Front.Solutions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;

namespace SIG.WebMVC.Controllers
{
    public class SolutionController : BaseController
    {
      
        private readonly ISolutionService _solutionService;      
        private IMapper _mapper;
        public SolutionController( ISolutionService solutionService,  IMapper mapper)
        {
            _solutionService = solutionService;          
            _mapper = mapper;
        }
        // GET: Solution
        public async Task<PartialViewResult> GetSolutionForHome()
        {
            var list = await _solutionService.GetActiveElementsAync();

            var solutionList = _mapper.Map<IEnumerable<Solution>, IEnumerable<SolutionVM>>(list.Take(8));
            return PartialView("_GetSolutionForHome", solutionList);
        }
    }
}